TreeGrid Master / Detail Tutorial
6. Master detail tables in tree
Master detail relation in master tree and detail table with tree
-
It is possible to define master tree, where some children will be shown in detail grid and other children in the same parent will be normal or master rows in the master grid.
-
Define the master and detail grids as usual for master / detail plain tables.
In the master grid define the MainCol and nest the rows to tree like in normal TreeGrid.
Ensure all the master rows in tree will get the master default row that defines the detail children, use appropriate Def/CDef attributes.
-
Set attribute
AddDefChildren
='2' to the default row that is used for master rows and defines the detail children.
It will add its children to all master rows, even to those having their children already.
-
Define new default row (e.g. <D Name='Detail'/>) and attach it to all the detail children defined in the default master row.
Set the detail default attribute Visible='0' and if the master grid has filter also CanFilter='0'.
To never show the detail rows in the master grid.
-
In master grid set also Cfg attribute
DetailExpand
='1' to expand / collapse the master rows normally and not show them in detail grid.
-
In detail grid set Cfg attribute
MasterDef
to the default detail row name (e.g. the 'Detail') defined above.
Only rows using this default will be shown in the detail grid. To not show the other standard master rows here.
-
If you permit dragging in master grid, you should set in detail grid <Root AcceptDef=''/> to not permit dragging into the detail grid.
-
To define tree structure in detail grid define appropriate default rows with children.
To the children in the main default attach new default that defines its own children. Set also CopyTo attribute that will bubble the changes up and down.
The tree structure is completely independent on master tree structure in this case.